<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <link rel="stylesheet" href="../lib/css/bootstrap.min.css">
  <link rel="stylesheet" href="../css/index.css">
  <script src="../lib/js/jquery.min.js"></script>
  <script src="../lib/js/bootstrap.min.js"></script>
  <script src="../lib/js/underscore.js"></script>
  <title>Document</title>
</head>

<body>
  <div class="page">
      <nav class="navbar navbar-default navbar-fixed-top">
          <div class="container">
            <!-- Brand and toggle get grouped for better mobile display -->
            <div class="navbar-header">
              <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
              </button>
              <a class="navbar-brand" href="index.html">Logo</a>
            </div>
            <!-- Collect the nav links, forms, and other content for toggling -->
            <div class="collapse navbar-collapse" id="navbar">
              <ul class="nav nav-pills navbar-right">
                  <li><a href="admin.html">系统</a></li>
                  <li><a href="#">退出</a></li>
              </ul>
            </div><!-- /.navbar-collapse -->
          </div><!-- /.container-fluid -->
        </nav>
    <div class="container">
      <div class="m-title">我的
        <span>/User</span>
      </div>
      <form class="form-inline">
        <div class="form-group">
          <label>日期</label>
          <input type="date" class="form-control" style="width: auto;">
        </div>
        <div class="form-group">
          <label>类型</label>
          <div class="btn-group">
            <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                <span class="sel-item">全部</span> <span class="caret"></span>
            </button>
            <ul class="dropdown-menu article-tpl-sel">
              <li><a>全部</a></li>
              <li><a>入库</a></li>
              <li><a>出库</a></li>
            </ul>
          </div>
        </div>
        <!-- <button type="submit" class="btn btn-default">Send invitation</button> -->
      </form>
      <br>
      <div class="table-responsive my-record-list">
        <table class="table">
          <thead>
            <tr>
              <th>序号</th>
              <th>时间</th>
              <th>表格标题</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td>1</td>
              <td>2018/09/01</td>
              <td>内容内容内容内容内容内容内容内容</td>
            </tr>
            <tr>
              <td>2</td>
              <td>2018/09/01</td>
              <td>内容内容内容内容内容内容内容内容</td>
            </tr>
            <tr>
              <td>3</td>
              <td>2018/09/01</td>
              <td>内容内容内容内容内容内容内容内容</td>
            </tr>
            <tr>
              <td>4</td>
              <td>2018/09/01</td>
              <td>内容内容内容内容内容内容内容内容</td>
            </tr>
            <tr>
              <td>5</td>
              <td>2018/09/01</td>
              <td>内容内容内容内容内容内容内容内容</td>
            </tr>
            <tr>
              <td>6</td>
              <td>2018/09/01</td>
              <td>内容内容内容内容内容内容内容内容</td>
            </tr>
            <tr>
              <td>7</td>
              <td>2018/09/01</td>
              <td>内容内容内容内容内容内容内容内容</td>
            </tr>
            <tr>
              <td>8</td>
              <td>2018/09/01</td>
              <td>内容内容内容内容内容内容内容内容</td>
            </tr>
            <tr>
              <td>9</td>
              <td>2018/09/01</td>
              <td>内容内容内容内容内容内容内容内容</td>
            </tr>
            <tr>
              <td>10</td>
              <td>2018/09/01</td>
              <td>内容内容内容内容内容内容内容内容</td>
            </tr>
            <tr>
              <td>11</td>
              <td>2018/09/01</td>
              <td>内容内容内容内容内容内容内容内容</td>
            </tr>
          </tbody>
        </table>
      </div>
    </div>
  </div>
  <script type="text/template" id="tpl">
    <% _.each(recordData, function(n){ %>
      <tr>
        <td><%= n.index %></td>
        <td><%= n.date %></td>
        <td><%= n.con %></td>
      </tr>
    <% }); %>
  </script>
  <script>
    var recordData = null;
    var maxPage = 3;
    var curPage = 1;
    $(window).on("scroll", function () {
      var scrollT = $(window).scrollTop();
      var windowH = $(window).height();
      var docH = $(document).height();
      if (scrollT + windowH >= docH) {
        if (curPage < maxPage) {
          $.ajax({
            url: '../../lib/data/test.json',
            type: 'GET',
            dataType: 'json',
            success: function(data) {
              recordData = data;
              $('.my-record-list tbody').append(_.template($('#tpl').html(), recordData));
              curPage++;
            }
          }); 
        }
      } 
    })
  </script>
</body>
</html>